﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="StsManager.aspx.cs" Inherits="main" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>STS Manager</title>
    <link rel="stylesheet" type="text/css" href="styles\StyleSheet.css" />
    
    <object type="application/x-informationcard" name="_xmlToken">
        <!--<param name="issuer" value= "http://schemas.xmlsoap.org/ws/2005/05/identity/issuer/self" />-->
        <param name="issuer" value= "http://neptune/STSImplSample/STSImplSample.svc/wst13" />
        <param name="tokenType" value="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1" />
        <param name="requiredClaims" value="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/privatepersonalidentifier" />
    </object>
    <object type="application/x-informationcard" name="_xmlToken2">
        <param name="issuer" value= "http://neptune/STSImplSample/STSImplSample.svc/wst13" />
        <param name="tokenType" value="http://specs.openid.net/auth/2.0" />
        <param name="requiredClaims" value="http://schema.openid.net/2007/05/claims/identifier" />
    </object>
    
    <script type="text/javascript" src="information_card.js"></script>    
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" EnablePartialRendering="true" runat="server" />
    <table style="width: 100%;">
        <tr>
            <td class="stsHeader">
                STS Registry Services
            </td>
        </tr>
        <tr>
            <td>
                <table width="100%" cellspacing="0" cellpadding="0" border="0">
                    <tr>
                        <td align="left">
                            <asp:Label ID="Label_UserFullName" runat="server">Welcome</asp:Label>
                        </td>
                        <td align="right">
                            <asp:HyperLink ID="HyperLink1" runat="server" Font-Underline="False" ForeColor="Black"
                                NavigateUrl="~/StsLogin.aspx" EnableViewState="False">Logout</asp:HyperLink>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td class="stsMainBody" style="padding: 10px 10px 10px 10px;">
                <cc1:Accordion ID="Accordion1" runat="server" HeaderCssClass="accordionHeader" HeaderSelectedCssClass="accordionHeaderSelected"
                    ContentCssClass="accordionContent" SuppressHeaderPostbacks="true" EnableViewState="false">
                    <Panes>
                        <cc1:AccordionPane ID="AccordionPane3" runat="server">
                            <Header>User Information</Header>
                            <Content>
                                <table width="100%" class="stsFont" style="text-align: left;">
                                    <tr>
                                        <td style="text-align: right;">Username:</td>
                                        <td><asp:TextBox ID="txtUserName" runat="server" width="270px" /></td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: right;">Password:</td>
                                        <td><asp:TextBox ID="txtPassword" runat="server" width="270px" TextMode="Password" /></td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: right;">Confirm Password:</td>
                                        <td><asp:TextBox ID="txtPasswordConfirm" runat="server" width="270px" TextMode="Password" /></td>
                                    </tr>
                                    <tr>
                                        <td>&nbsp;</td>
                                        <td>
                                            <asp:Button ID="Button2" runat="server" Text="Update" onclick="Button2_Click" />
                                        </td>
                                    </tr>
                                </table>
                                <br />
                                <asp:ImageButton ID="ImageButtonGetCard" runat="server"
                                    onmouseover="this.src='imgs/infocard2_over.png'" 
                                    onmouseout="this.src='imgs/infocard2.png'"
                                    ImageUrl="~/imgs/infocard2.png" 
                                    AlternateText="Get your managed information card." 
                                    onclick="ImageButtonGetCard_Click" />
                                <asp:ImageButton ID="ImageButtonRegisterCard" runat="server"
                                    onmouseover="this.src='imgs/infocard3_over.png'" 
                                    onmouseout="this.src='imgs/infocard3.png'"
                                    ImageUrl="~/imgs/infocard3.png" 
                                    AlternateText="Register your information card." 
                                    onclick="ImageButtonRegisterCard_Click" 
                                    onclientclick="get_information_card()" />
                            </Content>
                        </cc1:AccordionPane>
                        <cc1:AccordionPane ID="AccordionPane1" runat="server">
                            <Header>Relying Parties</Header>
                            <Content>
                                <div>
                                    <p class="stsFont" style="text-align: center" >
                                        Associate a certificate to an endpoint.</p>
                                    <table width="100%" class="stsFont" style="text-align: left;">
                                        <tr>
                                            <td style="text-align: right;">Endpoint:</td>
                                            <td><asp:TextBox ID="EndPointTextBox" runat="server" Width="270px" /></td>
                                        </tr>
                                        <tr>
                                            <td style="text-align: right;">Certificate:</td>
                                            <td><asp:FileUpload ID="CertificateUpload" runat="server" Style="width: 270px;" /></td>
                                        </tr>
                                        <tr>
                                            <td>&nbsp;</td>
                                            <td><asp:Button ID="UploadCertificateButton" runat="server" Text="Upload" /></td>
                                        </tr>
                                    </table>
                                    <br />
                                    <div class="stsTableDiv1">
                                        <asp:GridView ID="RPTable" runat="server" AutoGenerateColumns="false" Width="100%"
                                            CellSpacing="0" CellPadding="1" EnableViewState="true" 
                                            OnRowDataBound="GridView1_RowDataBound" OnRowCommand="GridView1_RowCommand"
                                            OnRowDeleting="GridView1_RowDeleting" DataKeyNames="endpoint" >
                                            <HeaderStyle CssClass="tableHeader" />
                                            <AlternatingRowStyle CssClass="tableRowAlternate" />
                                            <RowStyle CssClass="tableRow" Wrap="False" BorderWidth="0px" />
                                            <Columns>
                                                <asp:BoundField DataField="endpoint" HeaderText="Endpoint" ItemStyle-CssClass="tableItems" />
                                                <asp:BoundField DataField="subject" HeaderText="Certificate Subject" ItemStyle-CssClass="tableItems" />
                                                <asp:TemplateField HeaderText="Select" ItemStyle-CssClass="tableItems">
                                                    <ItemTemplate>
                                                        <asp:LinkButton ID="LinkButton1" CommandArgument='<%# Eval("endpoint") %>' CommandName="Delete" runat="server">Delete</asp:LinkButton>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                            </Columns>
                                        </asp:GridView>
                                    </div>
                                    <br />
                                </div>
                            </Content>
                        </cc1:AccordionPane>
                        <cc1:AccordionPane ID="AccordionPane2" runat="server">
                            <Header>Claim Mapping</Header>
                            <Content>
                                    <p class="stsFont" style="text-align: center" >
                                        Add Claim Mapping</p>
                                    <table width="100%" class="stsFont" style="text-align: left;">
                                        <tr>
                                            <td style="text-align: right;">From Type:</td>
                                            <td><asp:TextBox ID="TextBoxFromType" runat="server" Width="270px" /></td>
                                        </tr>
                                        <tr>
                                            <td style="text-align: right;">To Type:</td>
                                            <td><asp:TextBox ID="TextBoxToType" runat="server" Width="270px" /></td>
                                        </tr>
                                        <tr>
                                            <td style="text-align: right;">From Value:</td>
                                            <td><asp:TextBox ID="TextBoxFromValue" runat="server" Width="270px" /></td>
                                        </tr>
                                        <tr>
                                            <td style="text-align: right;">To Value:</td>
                                            <td><asp:TextBox ID="TextBoxToValue" runat="server" Width="270px" /></td>
                                        </tr>
                                        <tr>
                                            <td>&nbsp;</td>
                                            <td>
                                                <asp:Button ID="ButtonAddClaimMapping" runat="server" Text="Add Claim Mapping" OnClick="ButtonAddClaimMapping_Click" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="text-align: right;">Endpoint:</td>
                                            <td>
                                                <asp:DropDownList ID="DropDownList1" runat="server" 
                                                    DataTextField="endpoint" 
                                                    DataValueField="endpoint" 
                                                    OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" 
                                                    AutoPostBack="true" Width="270px" />
                                            </td>
                                        </tr>
                                    </table>
                                    <br />

                                <div class="stsTableDiv1">
                                    <asp:GridView ID="CMTable" runat="server" AutoGenerateColumns="false" Width="100%"
                                        CellSpacing="0" CellPadding="1" EnableViewState="true" 
                                        OnRowDataBound="CMTable_RowDataBound" OnRowCommand="CMTable_RowCommand"
                                        OnRowDeleting="CMTable_RowDeleting" DataKeyNames="claimMapping_id" >
                                        <HeaderStyle CssClass="tableHeader" />
                                        <AlternatingRowStyle CssClass="tableRowAlternate" />
                                        <RowStyle CssClass="tableRow" Wrap="False" BorderWidth="0px" />
                                        <Columns>
                                            <asp:CheckBoxField  ReadOnly="false" ItemStyle-CssClass="tableItems" DataField="active" />
                                            <asp:BoundField DataField="fromType" HeaderText="From Type" ItemStyle-CssClass="tableItems" />
                                            <asp:BoundField DataField="toType" HeaderText="To Type" ItemStyle-CssClass="tableItems" />
                                            <asp:BoundField DataField="fromValue" HeaderText="From Value" ItemStyle-CssClass="tableItems" />
                                            <asp:BoundField DataField="toValue" HeaderText="To Value" ItemStyle-CssClass="tableItems" />
                                            <asp:TemplateField HeaderText="Select" ItemStyle-CssClass="tableItems">
                                                <ItemTemplate>
                                                    <asp:LinkButton ID="LinkButton2" CommandArgument='<%# Eval("claimMapping_id") %>' CommandName="Delete" runat="server">Delete</asp:LinkButton>
                                                    <asp:LinkButton ID="LinkButton3" CommandArgument='<%# Eval("claimMapping_id") %>' CommandName="Change" runat="server">Change</asp:LinkButton>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                        </Columns>
                                    </asp:GridView>
                                </div>
                            </Content>
                        </cc1:AccordionPane>
                        <cc1:AccordionPane ID="AccordionPane4" runat="server">
                            <Header>OpenID</Header>
                            <Content>
                                <asp:ImageButton ID="ImageButtonGetOpenIDCard" runat="server"
                                    onmouseover="this.src='imgs/infocard4_over.png'"
                                    onmouseout="this.src='imgs/infocard4.png'"
                                    ImageUrl="imgs/infocard4.png"
                                    AlternateText="Get your managed OpenID information card."
                                    onclick="ImageButtonGetOpenIDCard_Click" />
                                <asp:ImageButton ID="ImageButtonRegisterOpenIDCard" runat="server"
                                    onmouseover="this.src='imgs/infocard5_over.png'" 
                                    onmouseout="this.src='imgs/infocard5.png'"
                                    ImageUrl="~/imgs/infocard5.png" 
                                    AlternateText="Test your OpenID information card." 
                                    onclick="ImageButtonRegisterOpenIDCard_Click" 
                                    onclientclick="get_openid_information_card()" />
                            </Content>
                        </cc1:AccordionPane>                        
                    </Panes>
                </cc1:Accordion>
            </td>
        </tr>
        <tr>
            <td class="stsFooter">
                2008 José Figueiredo
            </td>
        </tr>

    </table>
    <asp:HiddenField ID="XmlTokenField" runat="server"/>
    </form>
</body>
</html>
